package com.community.zhihuishequ.view.base;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.community.zhihuishequ.R;
import com.community.zhihuishequ.net.entity.AppResponse;
import com.community.zhihuishequ.widget.LoadingLayout;
//import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import java.util.List;

/**
 * Created by Administrator on 2017/12/22 0022.
 */

public class BaseListFragment extends BaseFragment {

    protected RecyclerView recyclerView;
    protected LinearLayoutManager layoutManager;
//    protected SmartRefreshLayout swipeRefreshLayout;
    protected int totalPage = 0;
    protected int pageIndex = 0;
    protected int PAGE_SIZE = 10;
    public int timeType = 0;
    public String keyWord = "";
    protected LoadingLayout loadingLayout;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public View initView(LayoutInflater inflater, @Nullable ViewGroup container) {
        View view = inflater.inflate(R.layout.fragment_base_list, container, false);
        loadingLayout = view.findViewById(R.id.base_fragment_loading);
        recyclerView = loadingLayout.getRecyclerView();
//        swipeRefreshLayout = loadingLayout.getSmartRefreshLayout();
        return view;
    }

    protected boolean isAppResponseEmpty(AppResponse appResponse) {
        if (!appResponse.isSuccess()) {
            return false;
        } else return appResponse.haveData();
    }

    protected boolean isDataListEmpty(List dataList) {
        return !(dataList == null || dataList.size() <= 0);
    }

    public void getNewList(boolean append, Activity currentActivity, boolean isShowLoading) {

    }

    public void clearData() {

    }
}
